import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { MessageService } from '../../../core/service';
import { NzMessageService } from 'ng-zorro-antd';
import { LayoutRouteStatus } from 'src/app/components/breadcrumb/breadcrumb.component';

@Component({
    selector: 'app-member-center-home',
    templateUrl: './member-center-home.component.html',
    styleUrls: ['./member-center-home.component.scss'],
})
export class MemberCenterHomeComponent implements OnInit {
    constructor(private msg: MessageService, private message: NzMessageService) {}
    private _page: any = {
        pageNo: 1,
    };
    @ViewChild(TemplateRef) template: TemplateRef<{}>;

    private _layoutRouteStatus: LayoutRouteStatus = {
        breadcrumbs: [{ name: '医生个人中心' }],
        isHiddeBreadcrumb: true,
    };
    public chartOption = {
        title: {
            text: '',
            subtext: '',
            x: 'left',
        },
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b} : {c} ({d}%)',
        },
        toolbox: {
            show: false,
            feature: {
                mark: { show: false },
                dataView: { show: false, readOnly: false },
                magicType: {
                    show: false,
                    type: ['pie'],
                },
                restore: { show: false },
                saveAsImage: { show: false },
            },
        },
        calculable: false,
        series: [
            {
                name: '处方操作',
                type: 'pie',
                radius: ['40%', '80%'],
                center: ['50%', '50%'],
                data: [{ value: 25, name: '未通过' }, { value: 10, name: '违规操作' }, { value: 65, name: '完成' }],
            },
        ],
    };

    public chartOption1 = {
        title: {
            text: '',
            subtext: '',
            x: 'center',
        },
        color: ['#3398DB'],
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                // 坐标轴指示器，坐标轴触发有效
                type: 'shadow', // 默认为直线，可选为：'line' | 'shadow'
            },
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true,
        },
        xAxis: [
            {
                type: 'category',
                data: ['5-20', '5-21', '5-22', '5-23', '5-24', '5-25', '5-26'],
                axisTick: {
                    alignWithLabel: true,
                },
            },
        ],
        yAxis: [
            {
                type: 'value',
            },
        ],
        series: [
            {
                name: '人数',
                type: 'bar',
                barWidth: '60%',
                data: [180, 180, 180, 72, 132, 345, 45],
            },
        ],
    };

    public chartOption2 = {
        title: {
            text: '',
            subtext: '',
        },
        tooltip: {
            trigger: 'axis',
        },
        legend: {
            data: ['处方流转数量'],
        },
        toolbox: {
            show: true,
            feature: {
                mark: { show: true },
                dataView: { show: true, readOnly: false },
                magicType: { show: true, type: ['line', 'bar'] },
                restore: { show: true },
                saveAsImage: { show: true },
            },
        },
        calculable: true,
        xAxis: [
            {
                type: 'category',
                boundaryGap: false,
                data: ['05-25', '05-26', '05-27', '05-28', '05-29', '05-30', '05-31'],
            },
        ],
        yAxis: [
            {
                type: 'value',
                axisLabel: {
                    formatter: '{value} 张',
                },
            },
        ],
        series: [
            {
                name: '审核处方数量',
                type: 'line',
                data: [125, 88, 234, 156, 115, 133, 261],
                markPoint: {
                    data: [{ type: 'max', name: '最大值' }, { type: 'min', name: '最小值' }],
                },
                markLine: {
                    data: [{ type: 'average', name: '平均值' }],
                },
            },
        ],
    };
    type = 0;
    issm = false;
    tooltips1 = ['糟糕', '无效', '一般', '好', '非常好'];
    tooltips2 = ['糟糕', '无效', '一般', '好', '非常好'];
    tooltips3 = ['糟糕', '无效', '一般', '好', '非常好'];
    value1 = 4.5;
    value2 = 5;
    value3 = 4.6;
    blfyData = [{ text: '皮肤、粘膜出现瘀点', sel: false }, { text: '皮疹', sel: false }, { text: '恶心、呕吐、腹泻', sel: false }];
    _yaopinList = [
        {
            img: '../../../../../assets/img/lblcncrp.png',
            name: '雷贝拉唑钠肠溶片',
            guige: '20mg*7片/盒',
            changshang: '成都迪康制药公司',
            sms: '../../../../../assets/img/lblcncrpsms.png',
        },
        {
            img: '../../../../../assets/img/jtjssbjn.png',
            name: '胶体酒石酸铋胶囊(久铋)',
            guige: '55mg*24粒/盒',
            changshang: '山西星火维敏制药有限公司',
            sms: '../../../../../assets/img/jtjssbjnmsm.png',
        },
    ];
    ngOnInit() {
        this.msg.setTitle('药师工作站');
        this.loadList('医院科室类别列表');
    }
    onFK1(type) {
        this.type = type;
        this.issm = true;
    }
    handleCancel(): void {
        this.issm = false;
    }
    isShow(bool: boolean) {
        if (bool) {
            this._yaopinList = [
                { img: '../../../../../assets/img/lblcncrp.png', name: '雷贝拉唑钠肠溶片', guige: '规格：0.1*6颗', changshang: '成都迪康制药公司', sms: '../../../../../assets/img/lblcncrpsms.png' },
                { img: '../../../../../assets/img/jtjssbjn.png', name: '胶体酒石酸铋胶囊(久铋)', guige: '55mg*24粒/盒', changshang: '山西星火维敏制药有限公司', sms: '../../../../../assets/img/jtjssbjnmsm.png' },
                { img: '../../../../../assets/img/0003.png', name: '枸枸橼酸莫沙比利片', guige: '5mg*10片/盒', changshang: '亚宝药业集团股份有限公司', sms: '../../../../../assets/img/0003msm.png' },
                { img: '../../../../../assets/img/004.png', name: '克拉霉素缓释片', guige: '0.5g*7片/盒', changshang: '海南普利制药股份有限公司', sms: '../../../../../assets/img/004msm.png' },
            ];
        } else {
            this._yaopinList = [
                { img: '../../../../../assets/img/lblcncrp.png', name: '雷贝拉唑钠肠溶片', guige: '20mg*7片/盒', changshang: '成都迪康制药公司', sms: '../../../../../assets/img/lblcncrpsms.png' },
                { img: '../../../../../assets/img/jtjssbjn.png', name: '胶体酒石酸铋胶囊(久铋)', guige: '55mg*24粒/盒', changshang: '山西星火维敏制药有限公司', sms: '../../../../../assets/img/jtjssbjnmsm.png' },
            ];
        }
    }

    async loadList(url) {
        const data = Object.assign(this._page, {});
    }
    public successListOk(data, url): void {
        switch (url) {
            case '商户平台转帐列表':
                this._page.pageNo = data.pageNo;
                this._page.pages = data.pages;
                this._page.totalCount = data.totalCount;
                console.log(data.list);
                break;
        }
    }
}
